package com.lagou.ex.controller;

import com.lagou.ex.entity.TbResume;
import com.lagou.ex.entity.TbUser;
import com.lagou.ex.service.ResumeService;
import com.lagou.ex.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/resume")
public class ResumeController {
    @Autowired
    private ResumeService resumeService;

    /**
     * 访问方式：http://localhost:7070/resume/query
     *
     * @return
     */
    @RequestMapping("/query")
    public List<TbResume> findAll() {
        return resumeService.findAll();
    }

    /**
     * 访问方式：http://localhost:7070/resume/one
     *
     * @return
     */
    @RequestMapping("/one")
    public TbResume findOne(Long id) {
        return resumeService.findOne(id);
    }

    /**
     * 访问方式：http://localhost:7070/resume/save
     */
    @RequestMapping(value = "/save", method = RequestMethod.POST)
    public TbResume saveBean(@RequestBody TbResume bean) {
        resumeService.saveBean(bean);
        return bean;
    }

    /**
     * 访问方式：http://localhost:7070/resume/update
     */
    @RequestMapping(value = "/update", method = RequestMethod.PUT)
    public TbResume updateBean(@RequestBody TbResume bean) {
        resumeService.updateBean(bean);
        return bean;
    }

    /**
     * 访问方式：http://localhost:7070/resume/delete
     */
    @RequestMapping(value = "/delete", method = RequestMethod.DELETE)
    public Integer deleteBean(Long id) {
        resumeService.deleteBean(id);
        return 1;
    }

}
